function initPageQuery(json) {
	//加载字段信息
	var panel = $('<div id="' + json.code + '_query_panel"></div>');
	$.ajax({
		url: host + "showAction/getModuleQueryList.html",
		data: {"moduleId": json.id},
		type: "POST",
		dataType: 'json',
		async: false,
		success: function(data) {
			var array = data.list;
			var table = $('<div class="grid-query-table"></div>');
			panel.append(table);
			pageParam.queryFields[json.code] = array;
			var size = createQueryPanel(array, table);
			if (size > 0) {
				//此操作不能删除，删除后不能显示在grid查询条件上
				$(document.body).append(panel);
				
				var html = $('<div class="grid-query-cell" style="padding-left: 40px;">' + 
					'<a class="easyui-linkbutton" icon="icon-search" href="javascript:void(0)" style="color: #0000ff" ' +
						'onclick="serarchFun(\'' + json.code + '\');">查&nbsp;询</a></div>');
					// + '<a class="easyui-linkbutton" icon="icon-cancel" href="javascript:void(0)" onclick="cleanFun(\'' + json.code + '\');">清空条件</a></div>');
				table.append(html);
			}
		}
	});
	return panel;
}

function createQueryPanel(array, table) {
	var querySize = 0;
	for (var i = 0;i < array.length;i ++) {
		var data = array[i];
		if (data.isHide == 1) {
			if (data.defaultValue == "" || data.defaultValue == undefined) {
				table.append($('<input type="hidden" id="_QUERY_' + data.tableName + "_" + data.fieldName + '"/>'));
			}
		} else {
			/*
				<option value="text">文本</option>
				<option value="number">数字</option>
				<option value="select">下拉框</option>
				<option value="textarea">大文本</option>
				<option value="date">时间</option>
				<option value="tree">树形结构</option>
				<option value="open">弹出选择窗口</option>
			*/
			var html = ['<div class="grid-query-cell">',
						'<div class="grid-query-title">', data.name, '：</div>'];
			if (data.type == "select") {
				html.push('<div class="grid-query-input">');
				html.push('<select id="_QUERY_' + data.tableName + "_" + data.fieldName + '" ');
				html.push(' style="width: ' + (data.width > 10 ? data.width : "120") + 'px;">');
				if (data.options) {
					html.push("<option value=''>--请选择--</option>");
					var options = {};
					eval("options = " + data.options);
					var valueField = options.valueField ? options.valueField : "value";
					var textField = options.textField ? options.textField : "text";
					for (var j = 0;j < options.data.length;j ++) {
						html.push("<option value='" + options.data[j][valueField] + "'>" + options.data[j][textField] + "</option>");
					}
				}
				html.push('</select></div>');
			} else if (data.type == "textarea") {
				html.push('<div class="grid-query-input" ' + (data.width > 10 ? 'style="width: ' + data.width + 'px"' : "") + '>');
				html.push('<textarea id="_QUERY_' + data.tableName + "_" + data.fieldName + '" ');
				html.push(' style="height: ' + (data.height > 10 ? data.height : 40) + 'px;">');
				html.push('</textarea></div>');
			} else if (data.type == "date" || data.format == "yyyy-MM-dd") {
				html.push('<div class="grid-query-input">');
				html.push('<input id="_QUERY_' + data.tableName + "_" + data.fieldName + '" class="easyui-datebox" ');
				html.push(' style="width: ' + (data.width > 10 ? data.width : "120") + 'px;"/>');
				html.push('</div>');
				
				//按范围查询
				if (data.isRange == 1) {
					html.push('</div><div class="grid-query-cell">');
					html.push('<div class="grid-query-title" style="width: 30px;">至&nbsp;</div>');
					html.push('<div class="grid-query-input">');
					html.push('<input id="_QUERY_' + data.tableName + "_" + data.fieldName + '_END_" class="easyui-datebox" ');
					html.push(' style="width: ' + (data.width > 10 ? data.width : "120") + 'px;"/>');
					html.push('</div>');
				}
			} else if (data.type == "text" || data.type == "number") {
				html.push('<div class="grid-query-input">');
				html.push('<input id="_QUERY_' + data.tableName + "_" + data.fieldName + '" ');
				html.push(' style="width: ' + (data.width > 10 ? data.width : "120") + 'px;"/>');
				html.push('</div>');
				
				//按范围查询
				if (data.isRange == 1) {
					html.push('</div><div class="grid-query-cell">');
					html.push('<div class="grid-query-title" style="width: 30px;">至&nbsp;</div>');
					html.push('<div class="grid-query-input">');
					html.push('<input id="_QUERY_' + data.tableName + "_" + data.fieldName + '_END_" ');
					html.push(' style="width: ' + (data.width > 10 ? data.width : "120") + 'px;"/>');
					html.push('</div>');
				}
			}
			html.push('</div>');
			table.append(html.join(""));
			if (data.type == "date" || data.format == "yyyy-MM-dd") {
				if (data.defaultValue) {
					$("#_QUERY_" + data.tableName + "_" + data.fieldName).datebox({value: data.defaultValue});
				} else {
					$("#_QUERY_" + data.tableName + "_" + data.fieldName).datebox({});
				}
				//按范围查询
				if (data.isRange == 1) {
					$("#_QUERY_" + data.tableName + "_" + data.fieldName + "_END_").datebox({});
				}
			} else if (data.defaultValue) {
				$("#_QUERY_" + data.tableName + "_" + data.fieldName).val(data.defaultValue);
			}
			querySize ++;
		}
	}
	return querySize;
}